package com.chen.controller;

import com.chen.entity.QQUser;
import com.chen.entity.dto.RegisterDto;
import com.chen.entity.vo.Result;
import com.chen.entity.vo.ResultCodeEnum;
import com.chen.service.QQUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("api/qqUser")
public class QQUserController {
    @Autowired
    private QQUserService qqUserService;

    /**
     * 登录
     * @param qqUser
     * @return
     */
    @PostMapping("/login")
    public Result  Login(@RequestBody QQUser qqUser){
        qqUserService.login(qqUser);
        return Result.build(null, ResultCodeEnum.SUCCESS);
    }

    /**
     * 注册
     * @param
     * @return
     */
    @PostMapping("/register")
    public Result  register(@RequestBody RegisterDto RegisterDto){
        Long qqNum= qqUserService.register(RegisterDto);
        return Result.build(qqNum, ResultCodeEnum.SUCCESS);
    }
}
